<?php

use Illuminate\Database\Seeder;
use App\Permission;

class PermissionSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        //这里先写几个权限;
        $permissiondata = [
          ['name'=>'system.login','display_name'=>'system.login','description'=>'登陆后台权限'],
          ['name'=>'system.index','display_name'=>'system.index','description'=>'后台首页'],
          ['name'=>'system.person','display_name'=>'person.center','description'=>'个人中心'],
          ['name'=>'person.edit','display_name'=>'person.edit','description'=>'个人资料修改'],
          ['name'=>'person.secret','display_name'=>'person.secret','description'=>'修改密码'],
          ['name'=>'member.manage','display_name'=>'member.center','description'=>'会员中心'],
          ['name'=>'member.list','display_name'=>'member.list','description'=>'会员列表'],
          ['name'=>'member.add','display_name'=>'member.add','description'=>'会员添加'],
          ['name'=>'member.del','display_name'=>'member.del','description'=>'会员删除'],
          ['name'=>'member.edit','display_name'=>'member.edit','description'=>'会员修改'],
          ['name'=>'mtype.list','display_name'=>'mtype.list','description'=>'会员类型列表'],
          ['name'=>'mtype.add','display_name'=>'mtype.add','description'=>'会员类型添加'],
          ['name'=>'mtype.del','display_name'=>'mtype.del','description'=>'会员类型删除'],
          ['name'=>'mtype.edit','display_name'=>'mtype.edit','description'=>'会员类型修改'],
          ['name'=>'mgroup.list','display_name'=>'mgroup.list','description'=>'会员分组列表'],
          ['name'=>'mgroup.add','display_name'=>'mgroup.add','description'=>'会员分组添加'],
          ['name'=>'mgroup.del','display_name'=>'mgroup.del','description'=>'会员分组删除'],
          ['name'=>'mgroup.edit','display_name'=>'mgroup.edit','description'=>'会员分组修改'],
          ['name'=>'msource.list','display_name'=>'msource.list','description'=>'会员来源列表'],
          ['name'=>'msource.add','display_name'=>'msource.add','description'=>'会员来源添加'],
          ['name'=>'msource.del','display_name'=>'msource.del','description'=>'会员来源删除'],
          ['name'=>'msource.edit','display_name'=>'msource.edit','description'=>'会员来源修改'],
          ['name'=>'sell.list','display_name'=>'sell.list','description'=>'销售列表'],
          ['name'=>'sell.add','display_name'=>'sell.add','description'=>'销售添加'],
          ['name'=>'sell.del','display_name'=>'sell.del','description'=>'销售删除'],
          ['name'=>'sell.edit','display_name'=>'sell.edit','description'=>'销售修改'],
          ['name'=>'guest.list','display_name'=>'guest.list','description'=>'游客列表'],
          ['name'=>'manage.center','display_name'=>'manage.center','description'=>'管理中心'],
          ['name'=>'mody.list','display_name'=>'mody.list','description'=>'糖尿病类型列表'],
          ['name'=>'mody.add','display_name'=>'mody.add','description'=>'糖尿病类型添加'],
          ['name'=>'mody.del','display_name'=>'mody.del','description'=>'糖尿病类型删除'],
          ['name'=>'mody.edit','display_name'=>'mody.edit','description'=>'糖尿病类型修改'],
          ['name'=>'diet.list','display_name'=>'diet.list','description'=>'饮食类型列表'],
          ['name'=>'diet.add','display_name'=>'diet.add','description'=>'饮食类型添加'],
          ['name'=>'diet.del','display_name'=>'diet.del','description'=>'饮食类型删除'],
          ['name'=>'diet.edit','display_name'=>'diet.edit','description'=>'饮食类型修改'],
          ['name'=>'sports.list','display_name'=>'sports.list','description'=>'运动类型列表'],
          ['name'=>'sports.add','display_name'=>'sports.add','description'=>'运动类型添加'],
          ['name'=>'sports.del','display_name'=>'sports.del','description'=>'运动类型删除'],
          ['name'=>'sports.edit','display_name'=>'sports.edit','description'=>'运动类型修改'],
          ['name'=>'team.list','display_name'=>'team.list','description'=>'团队成员列表'],
          ['name'=>'team.add','display_name'=>'team.add','description'=>'团队成员添加'],
          ['name'=>'team.del','display_name'=>'team.del','description'=>'团队成员删除'],
          ['name'=>'team.edit','display_name'=>'team.edit','description'=>'团队成员修改'],
          ['name'=>'role.list','display_name'=>'role.list','description'=>'显示角色列表'],
          ['name'=>'role.add','display_name'=>'role.add','description'=>'创建角色'],
          ['name'=>'role.del','display_name'=>'role.del','description'=>'删除角色'],
          ['name'=>'role.edit','display_name'=>'role.edit','description'=>'修改角色'],
          ['name'=>'permission.list','display_name'=>'permission.list','description'=>'显示权限列表'],
          ['name'=>'permission.add','display_name'=>'permission.create','description'=>'创建权限'],
          ['name'=>'permission.del','display_name'=>'permission.del','description'=>'删除权限'],
          ['name'=>'permission.edit','display_name'=>'permission.edit','description'=>'修改权限'],

        ];
        //这是写foreach;遍历到表中;
        foreach ($permissiondata as $data) {
          $permission = new Permission();
          $permission -> name = $data['name'];
          $permission -> display_name = $data['display_name'];
          $permission -> description = $data['description'];
          $permission -> save();
        }
    }
}
